Skip to main content
Complete reference for llama-server, llama-cli, llama-sweep-bench, llama-bench, llama-imatrix, and llama-quantize parameters. All parameters supported by llama-server can also be used with the other tools where applicable.
Common terms used throughout this documentation and in model descriptions.
Core parameters for loading and running any model.
Speculative decoding accelerates generation by using a fast draft model to predict multiple tokens ahead, which the main model then verifies in a single forward pass.
When a conversation ends, its KV cache is saved to RAM and can be restored when the same or similar prompt is seen again. This greatly reduces prompt processing time when switching between conversations.
If available RAM is very limited, disable this with -cram 0 to avoid memory swapping.
Sampling controls how tokens are selected during generation. The default sampler pipeline provides a good balance for most use cases.For a detailed overview of sampling techniques, see the llm_samplers_explained guide.
The prompt template controls how chat messages are formatted before being sent to the model. An incorrect template can significantly degrade output quality.
The KV cache stores past attention computations to avoid reprocessing tokens. These parameters control where the cache lives and how it is quantized.The KV cache is stored on the same device as the associated attention tensors. Quantizing the KV cache can significantly reduce VRAM usage.KV cache types (build with -DGGML_IQK_FA_ALL_QUANTS=ON for the full list):
Serve multiple users or frontends simultaneously. The WebUI uses parallel slots to allow starting a new chat while another is still generating.
ik_llama.cpp provides extensive control over what runs on the GPU. For a full guide, see GPU offloading and Hybrid CPU/GPU inference.
Parameters for configuring how the model is loaded and how draft models work.
Parameters specific to llama-server.

sweep-bench

Benchmarks prompt processing and token generation across a sweep of batch sizes. The KV cache is not cleared between runs, so the N_KV column shows how many tokens were in cache.

llama-bench

Standard benchmark utility.

llama-imatrix

Generate an importance matrix from calibration text. The imatrix improves quantization quality across all quant types.
Notes:
  • Use convert_imatrix_gguf_to_dat.py to convert GGUF imatrix files to the format used internally.
  • imatrix calculation supports models with merged ffn_up/gate_exps tensors.

llama-quantize

Quantize a BF16 or F16 model to a compressed format.
To split the output for easier distribution:
CMake build configuration flags.
Environment variables that influence runtime behavior.